<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
	<meta name="apple-mobile-web-app-capable" content="yes"/>
	<title>Editable Icon Container</title>

	<link href="../themes/common/domButtons/DomButtonRedBadge.css" rel="stylesheet"/>
	<script type="text/javascript" src="../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base','IconContainer']"></script>
	<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true"></script>

	<script type="text/javascript">
		require([
			"dojo/_base/connect",
			"dojo/dom",
			"dojo/ready",
			"dijit/registry",
			"dojox/mobile/parser",
			"dojox/mobile",
			"dojox/mobile/compat",
			"dojox/mobile/IconContainer",
			"dojox/mobile/ScrollableView"
		], function(connect, dom, ready, registry){
			startEdit = function(){
				registry.byId("iconContainer").startEdit();
			}
			endEdit = function(){
				registry.byId("iconContainer").endEdit();
			}			
			ready(function(){
				connect.connect(registry.byId("iconContainer"), "onStartEdit", function(){
					dom.byId("btn1").style.display = "none";
					dom.byId("btn2").style.display = "";				
				});
				dojo.connect(registry.byId("iconContainer"), "onEndEdit", function(){
					dom.byId("btn1").style.display = "";
					dom.byId("btn2").style.display = "none";				
				});				
			});
		});
	</script>

	<style>
		.box {
			border: 1px solid #A7C0E0;
			width: 300px;
			height: 250px;
			background-image: url(images/widget-bg.png);
			background-repeat: no-repeat;
			background-color: white;
		}
	</style>
</head>
<body style="visibility:hidden;">
	<div id="view1" data-dojo-type="dojox.mobile.ScrollableView">
		<h1 data-dojo-type="dojox.mobile.Heading">Editable Icon Container</h1>
		<ul id="iconContainer" data-dojo-type="dojox.mobile.IconContainer" data-dojo-props='editable:true'>
			<li id="icon1" data-dojo-type="dojox.mobile.IconItem" data-dojo-props='label:"app1", icon:"images/icon1.png", badge:"55"'><div class="box"></div></li>
			<li data-dojo-type="dojox.mobile.IconItem" data-dojo-props='label:"app2", icon:"images/icon2.png", deletable:false'><div class="box"></div></li>
			<li data-dojo-type="dojox.mobile.IconItem" data-dojo-props='label:"app3", icon:"images/icon3.png"'><div class="box"></div></li>
			<li data-dojo-type="dojox.mobile.IconItem" data-dojo-props='label:"app4", icon:"images/icon4.png"'><div class="box"></div></li>
			<li data-dojo-type="dojox.mobile.IconItem" data-dojo-props='label:"app5", icon:"images/icon5.png"'><div class="box"></div></li>
			<li data-dojo-type="dojox.mobile.IconItem" data-dojo-props='label:"app6", icon:"images/icon6.png"'><div class="box"></div></li>
			<li data-dojo-type="dojox.mobile.IconItem" data-dojo-props='label:"app7", icon:"images/icon7.png"'><div class="box"></div></li>
			<li data-dojo-type="dojox.mobile.IconItem" data-dojo-props='label:"app8", icon:"images/icon8.png"'><div class="box"></div></li>
			<li data-dojo-type="dojox.mobile.IconItem" data-dojo-props='label:"app9", icon:"images/icon9.png"'><div class="box"></div></li>
			<li data-dojo-type="dojox.mobile.IconItem" data-dojo-props='label:"app10", icon:"images/icon10.png"'><div class="box"></div></li>
			<li data-dojo-type="dojox.mobile.IconItem" data-dojo-props='label:"moveTo", icon:"images/icon1.png", moveTo:"about", transition:"slide"'></li>
			<li data-dojo-type="dojox.mobile.IconItem" data-dojo-props='label:"href", icon:"images/icon2.png", href:"test_RoundRectList.html", transition:"slide"'></li>
			<li data-dojo-type="dojox.mobile.IconItem" data-dojo-props='label:"url", icon:"images/icon3.png", url:"data/view-sample.html", transition:"slide"'></li>
			<li data-dojo-type="dojox.mobile.IconItem" data-dojo-props='label:"url-async", icon:"images/icon4.png", url:"data/view-sample.html", transition:"slide", sync:false'></li>
		</ul>
		<button id="btn1" onclick="startEdit();">Start Edit</button>
		<button id="btn2" onclick="endEdit();" style="display:none;">End Edit</button>
	</div>

	<div id="about" data-dojo-type="dojox.mobile.View">
		<h1 data-dojo-type="dojox.mobile.Heading" data-dojo-props='back:"Icon Container", moveTo:"view1"'>About</h1>
		<h2 data-dojo-type="dojox.mobile.RoundRectCategory">My Phone</h2>
		<ul data-dojo-type="dojox.mobile.RoundRectList">
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='rightText:"AcmePhone"'>
				Network
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='rightText:"AcmePhone"'>
				Line
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='rightText:"1024"'>
				Songs
			</li>
		</ul>
	</div>
</body>
</html>
